﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Home.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Site.ViewModels.ArticleIndexViewModel>" %>
<%@ Import Namespace="SDT.Lib.Paging" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Tìm kiếm với từ khóa: <%=Model.Keyword%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<form action="/article/search" method="post" name="artcleForm">
    <div class="content-new">
        <h2>Kết quả tìm kiếm</h2>
        <div>
            <strong>Từ khóa:</strong><%=Model.Keyword%>
        </div>
        <%if (Model.Articles != null)
          { %>
        <div id="list-cate">
            <div class="pad">
                <%var first = Model.Articles != null && Model.Articles.Count > 0 ? Model.Articles[0] : null;
                  if (first != null)
                  {%>
                <div class="item-cate-first">
                    <div class="list-bor">
                        <div class="img-first">
                            <a href="/article/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>">
                                 <% string imgPath = (first.ImagePath != null && first.ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(first.ID, 214, 150, first.ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                                <img src="<%=imgPath %>" title="<%=first.Title %>" alt="<%=first.Title %>" />
                            </a>
                        </div>
                        <div class="art-content">
                            <div class="title-less-top">
                                <h3>
                                    <a href="/article/details/<%=first.ID %>/<%=Html.ToUrlFriendly(first.Title)%>"><%=first.Title%></a>
                                </h3>
                            </div>
                            <div class="date date-first"><%=first.AddDate != null ? (SDT.Lib.Common.Utils.ToDayOfWeekLabel(first.AddDate) +", "+ string.Format( "{0:dd/MM/yyyy, hh:mm tt}",first.AddDate)) : string.Empty%></div>
                            <div class="lead">
                                <%=first.Summary%>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                </div>
                <%} %>
                <%if (Model.Articles.Count > 1)
                  {
                      for (int i = 1; i < Model.Articles.Count; i++)
                      { %>
                   <div class="item-cate">
                        <div class="list-bor">
                            <div class="avatar">
                                <a href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>">
                                    <% string imgPath = (Model.Articles[i].ImagePath != null && Model.Articles[i].ImagePath != string.Empty) ? SDT.Lib.Common.Utils.GenThumbnail(Model.Articles[i].ID, 130, 100, Model.Articles[i].ImagePath, Model.ImagePath, Model.ImageUrl) : SDT.Lib.Common.Globals.DefaultLogo; %>
                                    <img style="height:100px; width:130px" src="<%=imgPath %>" title="<%=Model.Articles[i].Title %>" alt="<%=Model.Articles[i].Title %>" />
                                </a>
                            </div>                    
                            <div class="art-content">
                                <div class="title-less">
                                    <h3><a  href="/article/details/<%=Model.Articles[i].ID %>/<%=Html.ToUrlFriendly(Model.Articles[i].Title)%>"><%=Model.Articles[i].Title%></a></h3>
                                </div>
                                <div class="date date-first">
                                    <%=Model.Articles[i].AddDate != null ? (SDT.Lib.Common.Utils.ToDayOfWeekLabel(Model.Articles[i].AddDate) + ", " + string.Format("{0:dd/MM/yyyy, hh:mm tt}", Model.Articles[i].AddDate)) : string.Empty%> 
                                </div>
                                <div class="lead">
                                    <%=Model.Articles[i].Summary.Length < 350 ? Model.Articles[i].Summary : Model.Articles[i].Summary.Substring(0, 350) + "..."%>
                                </div>
                                <div class="clear"></div>
                            </div>
                        </div>
                   </div>     
                      <%}
                  } %>
            </div>
        </div>
        <%} %>
    </div>
    <%if (Model.Articles != null)
          { %>
    <div class="pagebarUTH f_r">
        Trang <%= Model.Articles.PageNumber%>/<%= Model.Articles.PageCount%>
        <%= Html.Pager(Model.Articles.PageSize, Model.Articles.PageNumber, Model.Articles.TotalItemCount)%>
     </div>
     <%} %>	
    </form>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="RightContent" runat="server">
  <% Html.RenderAction("Lasted", "Video", new { catid = 0, number = 3, title = string.Empty }); %>
   <div class="clear"></div>
   <% Html.RenderAction("Most", "Article", new { number = 5, skip = 0, catid =Model.Category!=null? Model.Category.ID:0, title = "Tin nhiều người đọc", order = "nViews", orderDir = "desc" }); %>
    <div class="clear"></div>
   <% Html.RenderAction("Lasted", "Event", new { number = 3, catid = Model.Category != null ? Model.Category.ID : 0 }); %>
   <div class="clear"></div>
   <% Html.RenderAction("NewestByCat", "Article", new { number = 3, skip = 0, catid =SDT.Model.ConfigManager.GetChuyengiaPhantich(), title = "Chuyên gia phân tích", order = "ID", orderDir = "desc" }); %>
   <div class="clear"></div>
   <% Html.RenderAction("NewestByCat", "Article", new { number = 3, skip = 0, catid =SDT.Model.ConfigManager.GetNhacuasao(), title = "Nhà của sao", order = "ID", orderDir = "desc" }); %>
   <div class="clear"></div>
   <% Html.RenderAction("NewestByCat", "Article", new { number = 3, skip = 0, catid =SDT.Model.ConfigManager.GetSacmaukientruc(), title = "Sắc màu kiến trúc", order = "ID", orderDir = "desc" }); %>
</asp:Content>
